#define _CRT_SECURE_NO_WARNINGS 1
#include "Complex.h";

Complex createComplex(double real, double imaginary)
{
	Complex c1;
	c1.real = real;
	c1.imaginary = imaginary;
	return c1;
}

void setComplexReal(Complex* c, double real)
{
	c->real = real;
}

void setComplexImag(Complex* c, double imaginary)
{
	c->imaginary = imaginary;
}

Complex add(Complex c1, Complex c2)
{
	Complex result;
	result.real = c1.real + c2.real;
	result.imaginary = c1.imaginary + c2.imaginary;
	return result;
}

Complex Sub(Complex c1, Complex c2)
{
	Complex result;
	result.real = c1.real - c2.real;
	result.imaginary = c1.imaginary - c2.imaginary;
	return result;
}

Complex Miv(Complex c1, Complex c2)
{
	Complex result;
	result.real = c1.real*c2.real-c1.imaginary*c2.imaginary;
	result.imaginary = c1.real*c2.imaginary + c2.real*c1.imaginary;
	return result;
}

Complex div(Complex c1, Complex c2)
{
	Complex tmp;
	tmp.real = c2.real;
	tmp.imaginary = -c2.imaginary;
	return Miv(c1, tmp);
}